package com.zsjt.app.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author zhanb
 */
@Controller
public class ViewController {

    @RequestMapping(value = "/lossPassword",method = {RequestMethod.GET})  //找回密码
    public String lossPassword(){
        return "lossPassword";
    }

    @PreAuthorize("isAuthenticated()")  //需要认证通过
    @RequestMapping(value = "/user/center",method = {RequestMethod.GET})
    public String myCenter(){
        return "user/myCenter";
    }
    /**
     * 系统管理菜单
     * @return
     */
    @PreAuthorize("hasAuthority('VIP1')") //用户VIP1权限才可以访问
    @RequestMapping(value = "/system/management/menu",method = {RequestMethod.GET})
    public String systemManagementMenu(){
        return "system/management/menu";
    }

    /**
     * 系统管理角色
     * @return
     */
    @PreAuthorize("hasAuthority('VIP1')") //用户VIP1权限才可以访问
    @RequestMapping(value = "/system/management/role",method = {RequestMethod.GET})
    public String systemManagementRole(){
        return "system/management/role";
    }

    /**
     * 系统管理用户
     * @return
     */
    @PreAuthorize("hasAuthority('VIP1')") //用户VIP1权限才可以访问
    @RequestMapping(value = "/system/management/user",method = {RequestMethod.GET})
    public String systemManagementUser(){
        return "system/management/user";
    }

    /**
     * 系统监控api
     * @return
     */
    @PreAuthorize("hasAuthority('VIP2')") //用户VIP2权限才可以访问
    @RequestMapping(value = "/system/monitor/interface",method = {RequestMethod.GET})
    public String systemMonitorInterface(){
        return "system/monitor/interface";
    }

    /**
     * 系统监控日志
     * 用户VIP2权限才可以访问
     * @return
     */
    @PreAuthorize("hasAuthority('VIP2')")
    @RequestMapping(value = "/system/monitor/log",method = {RequestMethod.GET})
    public String systemMonitorLog(){
        return "system/monitor/log";
    }

    /**
     * 系统监控sql
     * @return
     */
    @PreAuthorize("hasAuthority('VIP2')") //用户VIP2权限才可以访问
    @RequestMapping(value = "/system/monitor/sql",method = {RequestMethod.GET})
    public String systemMonitorSql(){
        return "system/monitor/sql";
    }

    /**
     * 系统监控定时任务
     * @return
     */
    @PreAuthorize("hasAuthority('VIP2')") //用户VIP2权限才可以访问
    @RequestMapping(value = "/system/monitor/tasks",method = {RequestMethod.GET})
    public String systemMonitorTasks(){
        return "system/monitor/tasks";
    }

}
